<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>自定义对象嵌套</title>
    <script type="text/javascript">
        var StudentData = {
            age:"26",
            Tel:"10086",
            teacher:"呵呵"
        };
        var ZJDX = {
            name:"单南虹",
            address:"湖北武汉",
            grade:"401",
            score:"86",
            //嵌套对象
            data:StudentData,
            information:showInformation
        };
        //定义对象的方法
        function showInformation() {
            var msg = "";
            msg += "对象嵌套实例：\n\n";
            msg += "被嵌套对象直接属性值:\n";
            msg += "学生姓名：" + this.name + "\n";
            msg += "家庭住址：" + this.address + "\n";
            msg += "班级：" + this.grade + "\n";
            msg += "分数：" + this.score + "\n";
            msg += "访问嵌套对象直接属性值：\n";
            msg += "年龄：" + this.data.age + "\n";
            msg += "联系电话：" + this.data.Tel + "\n";
            msg += "班主任：" + this.data.teacher + "\n";
            window.alert(msg);
        }
    </script>
</head>
<body>
<form>
    <input type="button" value="check" onclick="ZJDX.information()">
</form>
</body>
</html>